/**
 * 
 */
package junit;
import static org.junit.Assert.*;

import java.sql.Connection;
import java.sql.SQLException;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import database_package.SqliteConnection;

/**
 * The class to test the SqliteConnection class.
 * @author Syrym
 */
public class SqliteConnectionTest {
	/**
	 * The Connection instance.
	 * @author Syrym
	 * */
	static Connection connection;
	/**
	 * Connection setup before class.
	 * @author Syrym
	 * @throws java.lang.Exception
	 */
	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		connection = SqliteConnection.dbConnect();
		// one-time initialization code   
    	System.out.println("@BeforeClass - setUpBeforeClass");
	}
	/**
	 * Connection destruction after class.
	 * @author Syrym
	 * @throws java.lang.Exception
	 */
	@AfterClass
	public static void tearDownAfterClass() throws Exception {
    	System.out.println("@AfterClass - tearDownAfterClass");
    	connection = null;
	}

	/**
	 * Connection setup.
	 * @author Syrym
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		System.out.println("@Before setUp");
		connection = SqliteConnection.dbConnect();
	}

	/**
	 * Connection tear down.
	 * @author Syrym
	 * @throws java.lang.Exception
	 */
	@After
	public void tearDown() throws Exception {
    	System.out.println("@After - tearDown");
    	connection.close();
    	connection = null;
	}

	/**
	 * Test method for {@link database_package.SqliteConnection#dbConnect()}.
	 * @throws SQLException 
	 */
	@Test
	public void testDbConnect() throws SQLException {
		connection = SqliteConnection.dbConnect();
		assertEquals(connection.isClosed(), false);

	}

}
